<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Upgrade iRedMail from 1.4.1 to 1.4.2</title>
        <link rel="stylesheet" type="text/css" href="./css/markdown.css" />
    </head>
    <body>

    <div id="navigation">
    <a href="https://www.iredmail.org" target="_blank">
        <img alt="iRedMail web site"
             src="./images/logo-iredmail.png"
             style="vertical-align: middle; height: 30px;"
             />&nbsp;
        <span>iRedMail</span>
    </a>
    &nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><h1 id="upgrade-iredmail-from-141-to-142">Upgrade iRedMail from 1.4.1 to 1.4.2</h1>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Check out the lightweight on-premises email archiving software developed by iRedMail team: <a href="https://spiderd.io/">Spider Email Archiver</a>.</p>
</div>
<div class="toc">
<ul>
<li><a href="#upgrade-iredmail-from-141-to-142">Upgrade iRedMail from 1.4.1 to 1.4.2</a><ul>
<li><a href="#changelog">ChangeLog</a></li>
<li><a href="#general-all-backends-should-apply-these-changes">General (All backends should apply these changes)</a><ul>
<li><a href="#update-etciredmail-release-with-new-iredmail-version-number">Update /etc/iredmail-release with new iRedMail version number</a></li>
</ul>
</li>
<li><a href="#for-openldap-backend">For OpenLDAP backend</a><ul>
<li><a href="#remove-unused-ldap-attributes">Remove unused LDAP attributes</a></li>
</ul>
</li>
<li><a href="#for-mysql-and-mariadb-backends">For MySQL and MariaDB backends</a><ul>
<li><a href="#fix-incorrect-sql-column-types-and-remove-unused-columns-in-vmailmailbox-tables">Fix incorrect SQL column types and remove unused columns in vmail.mailbox tables</a></li>
</ul>
</li>
<li><a href="#for-postgresql-backend">For PostgreSQL backend</a><ul>
<li><a href="#fix-incorrect-sql-column-types-and-remove-unused-columns-in-vmailmailbox-tables_1">Fix incorrect SQL column types and remove unused columns in vmail.mailbox tables</a></li>
<li><a href="#sogo-re-create-sql-view-and-update-config-file">SOGo: Re-create SQL VIEW and update config file</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="admonition note">
<p class="admonition-title">Remote Upgrade Assistance</p>
<p>Check out our <a href="https://www.iredmail.org/support.html">remote upgrade support</a> if you need assistance.</p>
</div>
<h2 id="changelog">ChangeLog</h2>
<ul>
<li>Sep 13, 2021: Initial release.</li>
</ul>
<h2 id="general-all-backends-should-apply-these-changes">General (All backends should apply these changes)</h2>
<h3 id="update-etciredmail-release-with-new-iredmail-version-number">Update <code>/etc/iredmail-release</code> with new iRedMail version number</h3>
<p>iRedMail stores the release version in <code>/etc/iredmail-release</code> after
installation, it's recommended to update this file after you upgraded iRedMail,
so that you can know which version of iRedMail you're running. For example:</p>
<pre><code>1.4.2
</code></pre>
<h2 id="for-openldap-backend">For OpenLDAP backend</h2>
<h3 id="remove-unused-ldap-attributes">Remove unused LDAP attributes</h3>
<p>Few LDAP attributes in <code>iredmail.schema</code> file are not used since day one, it's
time to remove them:</p>
<ul>
<li><code>lastLoginDate</code></li>
<li><code>lastLoginIP</code></li>
<li><code>lastLoginProtocol</code></li>
</ul>
<p>Download the latest iRedMail LDAP schema file</p>
<ul>
<li>On RHEL/CentOS:</li>
</ul>
<pre><code>wget -O /tmp/iredmail.schema https://github.com/iredmail/iRedMail/raw/1.4.2/samples/iredmail/iredmail.schema
mv /etc/openldap/schema/iredmail.schema{,.bak}
cp -f /tmp/iredmail.schema /etc/openldap/schema/
service slapd restart
</code></pre>
<ul>
<li>On Debian/Ubuntu:</li>
</ul>
<pre><code>wget -O /tmp/iredmail.schema https://github.com/iredmail/iRedMail/raw/1.4.2/samples/iredmail/iredmail.schema
mv /etc/ldap/schema/iredmail.schema{,.bak}
cp -f /tmp/iredmail.schema /etc/ldap/schema/
service slapd restart
</code></pre>
<ul>
<li>On FreeBSD:</li>
</ul>
<pre><code>wget -O /tmp/iredmail.schema https://github.com/iredmail/iRedMail/raw/1.4.2/samples/iredmail/iredmail.schema
mv /usr/local/etc/openldap/schema/iredmail.schema{,.bak}
cp -f /tmp/iredmail.schema /usr/local/etc/openldap/schema/
service slapd restart
</code></pre>
<ul>
<li>
<p>On OpenBSD:</p>
<blockquote>
<p>Note: if you're running ldapd as LDAP server, the schema directory is
<code>/etc/ldap</code>, and service name is <code>ldapd</code>.</p>
</blockquote>
</li>
</ul>
<pre><code>cd /tmp
ftp https://github.com/iredmail/iRedMail/raw/1.4.2/samples/iredmail/iredmail.schema
mv /etc/openldap/schema/iredmail.schema{,.bak}
cp -f /tmp/iredmail.schema /etc/openldap/schema/
rcctl restart slapd
</code></pre>
<h2 id="for-mysql-and-mariadb-backends">For MySQL and MariaDB backends</h2>
<h3 id="fix-incorrect-sql-column-types-and-remove-unused-columns-in-vmailmailbox-tables">Fix incorrect SQL column types and remove unused columns in <code>vmail.mailbox</code> tables</h3>
<p>iRedMail-1.4.1 introduced 3 new columns used to enable or disable per-user
SOGo webmail, calendar and activesync services, but they were set to improper
column <code>CHAR(1)</code> because SOGo doesn't support it, we will change them to
<code>VARCHAR(1)</code>:</p>
<ul>
<li><code>enablesogowebmail</code></li>
<li><code>enablesogocalendar</code></li>
<li><code>enablesogoactivesync</code></li>
</ul>
<p>3 columns are not used at all:</p>
<ul>
<li><code>lastlogindate</code></li>
<li><code>lastloginipv4</code></li>
<li><code>lastloginprotocol</code></li>
</ul>
<p>Please download plain SQL file used to update SQL table, then import it as
MySQL root user (Please run commands below as <code>root</code> user):</p>
<pre><code>wget -O /tmp/iredmail.mysql https://github.com/iredmail/iRedMail/raw/1.4.2/update/1.4.2/iredmail.mysql
mysql vmail &lt; /tmp/iredmail.mysql
rm -f /tmp/iredmail.mysql
</code></pre>
<h2 id="for-postgresql-backend">For PostgreSQL backend</h2>
<h3 id="fix-incorrect-sql-column-types-and-remove-unused-columns-in-vmailmailbox-tables_1">Fix incorrect SQL column types and remove unused columns in <code>vmail.mailbox</code> tables</h3>
<p>iRedMail-1.4.1 introduced 3 new columns used to enable or disable per-user
SOGo webmail, calendar and activesync services, but they were set to improper
column <code>CHAR(1)</code> because SOGo doesn't support it, we will change them to
<code>VARCHAR(1)</code>:</p>
<ul>
<li><code>enablesogowebmail</code></li>
<li><code>enablesogocalendar</code></li>
<li><code>enablesogoactivesync</code></li>
</ul>
<p>3 columns are not used at all:</p>
<ul>
<li><code>lastlogindate</code></li>
<li><code>lastloginipv4</code></li>
<li><code>lastloginprotocol</code></li>
</ul>
<p>Download plain SQL file used to update SQL table:</p>
<pre><code>wget -O /tmp/iredmail.pgsql https://github.com/iredmail/iRedMail/raw/1.4.2/update/1.4.2/iredmail.pgsql
chmod +r /tmp/iredmail.pgsql
</code></pre>
<ul>
<li>Connect to PostgreSQL server as <code>postgres</code> user and import the SQL file:<ul>
<li>on Linux, it's <code>postgres</code> user</li>
<li>on FreeBSD, it's <code>pgsql</code> user</li>
<li>on OpenBSD, it's <code>_postgresql</code> user</li>
</ul>
</li>
</ul>
<pre><code>su - postgres
psql -d vmail &lt; /tmp/iredmail.pgsql
</code></pre>
<ul>
<li>Remove downloaded file:</li>
</ul>
<pre><code>rm -f /tmp/iredmail.pgsql
</code></pre>
<h3 id="sogo-re-create-sql-view-and-update-config-file">SOGo: Re-create SQL VIEW and update config file</h3>
<p>Download plain SQL file used to update SQL table:</p>
<pre><code>wget -O /tmp/sogo.pgsql https://github.com/iredmail/iRedMail/raw/1.4.2/update/1.4.2/sogo.pgsql
chmod +r /tmp/sogo.pgsql
</code></pre>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Please open downloaded file <code>/tmp/sogo.pgsql</code>, replace placeholder
<code>VMAIL_DB_BIND_PASSWD</code> by the real password of SQL user <code>vmail</code>.
You can find the password in any file under <code>/etc/postfix/pgsql/</code>.</p>
</div>
<p>After updated <code>/tmp/sogo.pgsql</code>, please connect to PostgreSQL server as
<code>postgres</code> user and import the SQL file:</p>
<ul>
<li>on Linux, it's <code>postgres</code> user</li>
<li>on FreeBSD, it's <code>pgsql</code> user</li>
<li>on OpenBSD, it's <code>_postgresql</code> user</li>
</ul>
<pre><code>su - postgres
psql -d sogo &lt; /tmp/sogo.pgsql
</code></pre>
<ul>
<li>Remove downloaded file:</li>
</ul>
<pre><code>rm -f /tmp/sogo.pgsql
</code></pre><div class="footer">
    <p style="text-align: center; color: grey;">All documents are available in <a href="https://github.com/iredmail/docs/">GitHub repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://github.com/iredmail/docs/archive/master.zip">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div></body></html>